package com.guagua.system.controller;


import com.guagua.common.response.Result;
import com.guagua.system.entity.Dict;
import com.guagua.system.service.DictService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;

@Tag(name = "字典管理", description = "字典相关接口")
@RestController
@RequestMapping("/api/dict")
@RequiredArgsConstructor
public class DictController {
    
    private final DictService dictService;
    
    @Operation(summary = "根据字典类型获取字典数据")
    @GetMapping("/{dictType}")
    public Result<List<Dict>> getDictsByType(@PathVariable String dictType) {
        return Result.success(dictService.getDictsByType(dictType));
    }
    
    @Operation(summary = "获取所有字典数据")
    @GetMapping("/all")
    public Result<Map<String, List<Dict>>> getAllDict() {
        return Result.success(dictService.getAllDictMap());
    }
} 